<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<NerdDinner.Web.Models.Data.Dinner>" %>

<div id="rsvpmsg">
    <% if (Request.IsAuthenticated) { %> 
        <% if (Model.HasUserRsvped(Context.User.Identity.Name)) { %>        
            <p>You have RSVP'd this event!</p> 
        <% } else {  %>   
            <% using (Ajax.BeginForm( "Register", "RSVP", new { number = Model.DinnerId }, new AjaxOptions { UpdateTargetId = "rsvpmsg", OnSuccess = "AnimateRSVPMessage" })) { %>
               <input type="submit" value="RSVP for this event" />
            <% }  %> OR 
            <%= Ajax.ActionLink("RSVP for this event", "Register", "RSVP", new { number = Model.DinnerId }, new AjaxOptions { UpdateTargetId = "rsvpmsg", OnSuccess = "AnimateRSVPMessage" })%>
        <% }  %> 
    <% } else { %> 
        <a href="/Account/Logon">Logon</a> to RSVP for this event. 
    <% } %> 
</div>
